package com.guigu.dh.controller;

import com.guigu.dh.common.result.Result;
import com.guigu.dh.service.FileService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * DengHao
 * 2022-03-12
 */
@RestController
@RequestMapping("/api/oss/file")
public class FileApiController {

    @Autowired
    private FileService fileService;

    @ApiOperation("上传文件操作")
    @PostMapping("fileUpload")
    public Result fileUpload(MultipartFile file){
        String url = fileService.uploadGoToAliyunOss(file);
        return Result.ok(url);
    }
}
